﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace TPCN.DAL
{
    public class HangObj
    {
        #region [Private fields]
        private string _HangID;
        private string _Tenhang;
        private string _Thongtinsoluoc;
        private string _Thongtinchitiet;
        private string _Xuatxu;
        private string _DonvitinhID;
        private string _Thutu;
        private string _Title;
        private string _Keyword;
        private string _Description;
        private string _Url;
        private string _Active;
        private string _Anh;
        private string _Solanmua;
        private string _Giathitruong;
        private string _Giabanle;
        private string _Giabanbuon;
        #endregion

        #region [Public properties]
        public string HangID
        {
            get { return _HangID; }
            set { _HangID = value; }
        }

        public string Tenhang
        {
            get { return _Tenhang; }
            set { _Tenhang = value; }
        }

        public string Thongtinsoluoc
        {
            get { return _Thongtinsoluoc; }
            set { _Thongtinsoluoc = value; }
        }

        public string Thongtinchitiet
        {
            get { return _Thongtinchitiet; }
            set { _Thongtinchitiet = value; }
        }

        public string Xuatxu
        {
            get { return _Xuatxu; }
            set { _Xuatxu = value; }
        }

        public string DonvitinhID
        {
            get { return _DonvitinhID; }
            set { _DonvitinhID = value; }
        }

        public string Thutu
        {
            get { return _Thutu; }
            set { _Thutu = value; }
        }

        public string Title
        {
            get { return _Title; }
            set { _Title = value; }
        }

        public string Keyword
        {
            get { return _Keyword; }
            set { _Keyword = value; }
        }

        public string Description
        {
            get { return _Description; }
            set { _Description = value; }
        }

        public string Url
        {
            get { return _Url; }
            set { _Url = value; }
        }

        public string Active
        {
            get { return _Active; }
            set { _Active = value; }
        }

        public string Anh
        {
            get { return _Anh; }
            set { _Anh = value; }
        }

        public string Solanmua
        {
            get { return _Solanmua; }
            set { _Solanmua = value; }
        }

        public string Giathitruong
        {
            get { return _Giathitruong; }
            set { _Giathitruong = value; }
        }

        public string Giabanle
        {
            get { return _Giabanle; }
            set { _Giabanle = value; }
        }

        public string Giabanbuon
        {
            get { return _Giabanbuon; }
            set { _Giabanbuon = value; }
        }
        #endregion

        #region [Public methods]
        public HangObj SetValuesFromDataReader(IDataReader reader)
        {
            HangObj obj = new HangObj();
            obj.HangID = (reader["HangID"] is DBNull) ? String.Empty : reader["HangID"].ToString();
            obj.Tenhang = (reader["Tenhang"] is DBNull) ? String.Empty : reader["Tenhang"].ToString();
            obj.Thongtinsoluoc = (reader["Thongtinsoluoc"] is DBNull) ? String.Empty : reader["Thongtinsoluoc"].ToString();
            obj.Thongtinchitiet = (reader["Thongtinchitiet"] is DBNull) ? String.Empty : reader["Thongtinchitiet"].ToString();
            obj.Xuatxu = (reader["Xuatxu"] is DBNull) ? String.Empty : reader["Xuatxu"].ToString();
            obj.DonvitinhID = (reader["DonvitinhID"] is DBNull) ? String.Empty : reader["DonvitinhID"].ToString();
            obj.Thutu = (reader["Thutu"] is DBNull) ? "0" : reader["Thutu"].ToString();
            obj.Title = (reader["Title"] is DBNull) ? String.Empty : reader["Title"].ToString();
            obj.Keyword = (reader["Keyword"] is DBNull) ? String.Empty : reader["Keyword"].ToString();
            obj.Description = (reader["Description"] is DBNull) ? String.Empty : reader["Description"].ToString();
            obj.Url = (reader["Url"] is DBNull) ? String.Empty : reader["url"].ToString();
            obj.Active = (reader["Active"] is DBNull) ? String.Empty : reader["Active"].ToString();
            obj.Anh = (reader["Anh"] is DBNull) ? String.Empty : reader["Anh"].ToString();
            obj.Solanmua = (reader["Solanmua"] is DBNull) ? "0": reader["Solanmua"].ToString();
            obj.Giabanbuon = (reader["Giabanbuon"] is DBNull) ? "0" : reader["Giabanbuon"].ToString();
            obj.Giabanle = (reader["Giabanle"] is DBNull) ? "0" : reader["Giabanle"].ToString();
            obj.Giathitruong = (reader["Giathitruong"] is DBNull) ? "0" : reader["Giathitruong"].ToString();
            return obj;
        }

        #endregion
    }
}
